{% extends "Common/AdminBase.html" %}
{% load filters %} 
{% block Location %}

<li class="current">友情链接</li>
<script>
//设置当前导航
Nav_Page="SysLink";
</script>

{% endblock %}


{% block content %}
<script type="text/javascript" src='/site_media/admin/scripts/jquery.dragsort-0.5.1.min.js'></script>


  <input type="button" dataType="DialogAjax" dataval="/AdminMain/Link/Add/" alt="添加友情链接"  value="添加友情链接" class="btn">
<div class="status info">
        	
        	<p><img src="/site_media/admin/img/icons/icon_info.png" alt="Information"><span>提示:</span> 拖动列表交换友情链接的排列顺序</p>
        </div>
<div class="contentcontainer">
	
            <div class="headings altheading">
                <h2>友情链接</h2>
            </div>
            <div class="contentbox nopad ui-tabs-panel ui-widget-content ui-corner-bottom" id="contentboxitem">
              {% for info in  Model %}
             	<div class="newsitem" dataOrderid='{{info.LinkId}}' >
                   <a target="_blank"  href='{{info.WebUrl}}'> 
				   {% ifequal  info.imgUrl '' %} 
				   <img  src="/site_media/admin/img/news_temp.png" width="180"  height="57" class="hoverimg" alt="News">
                   {% else %}
				    <img src="{{info.imgUrl}}" class="hoverimg" width="180"  height="57"  onerror="this.src='/site_media/admin/img/news_temp.png' "  alt="News">
					{% endifequal%}
				   
				    <h3> {{info.Title}}</h3></a>
					<p>
						链接地址： <a  target="_blank" href='{{info.WebUrl}}' >{{info.WebUrl}}</a>
					   <br>
					   <a href="{{info.WebUrl}}" dataType="DialogAjax" dataval="/AdminMain/Link/Edit/?LinkId={{info.LinkId}}" alt="编辑友情链接" >修改</a>
					   
					   &nbsp;
					   
					    <a href="{{info.WebUrl}}"  dataType="confimsubmit" datareturn="PageRefresh"   dataval="/AdminMain/Link/DoDel/?LinkId={{info.LinkId}}" dataTip="你确定[删除]该链接?">删除</a>
					</p>
                </div>
             {% endfor %}
			 
			 	   {% ifequal Model|length 0 %} 
			 <div class="newsitem">
				   <img src="/site_media/admin/img/news_temp.png" width="180"  height="57"  class="hoverimg" alt="News">
             
				    <h3>还没添加友情链接</h3>
					<p>拖动列表能交换友情链接的排列顺序<br><a href="#" dataType="DialogAjax" dataval="/AdminMain/Link/Add/" alt="添加友情链接"  value="添加友情链接">添加友情链接</a></p>
                </div>
			 		{% endifequal %}
            </div>

         </div>    
         
  <script type="text/javascript">
		$("#contentboxitem").dragsort({ dragSelector: "div", dragBetween: true, dragEnd: saveOrder, placeHolderTemplate: "" });
		
		function saveOrder(test) {
			//alert($(this).attr("dataOrderid")) 
			var data = $("#contentboxitem div").map(function() { return $(this).attr('dataOrderid'); }).get().join(',');
		
			 $.AjaxServer('/AdminMain/Link/DoMobile/',{dataOrderid:data},function(){
			   $.tips('操作成功');
			 })
				 
		};
	</script>
         
         
  
{% endblock %}



